package cn.xxxy.fourm.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import cn.xxxy.fourm.entity.ReplyPost;
import cn.xxxy.fourm.model.ReplyPostDto;

public interface ReplyPostDao extends JpaRepository<ReplyPost, Integer>{
	/**
	 * 查看主贴所有回帖
	 * @param pid
	 * @return
	 */
	@Query("from ReplyPost where pid=?1")
	List<ReplyPost> listById(int pid);
	/**
	 * 查看某个用户所有回帖
	 * @param uid
	 * @return
	 */
	@Query("from ReplyPost where uid=?1")
	List<ReplyPost> findByUId(Integer uid);
	@Query(value="select * from t_reply_post where pid in (select pid from t_post where uid=?1)",nativeQuery=true)
	List<ReplyPost> findMyAllReply(Integer uid);
}
